import json
from flask import Flask
from flask import request
from flask_cors import CORS

from utils.tool import create_access_token,setResponseData, setResponse

from utils.extensions import db

from admin_route.route_basic import routes_basic
from admin_route.route_public import routes_public
from member_route.route_basic import member_main


app = Flask(__name__)

app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root:linguozhan@localhost/mutuanzhang'

db.init_app(app)


# 在应用上下文中创建所有表
with app.app_context():
    db.create_all()

CORS(app)

app.register_blueprint(routes_basic)
app.register_blueprint(routes_public)
app.register_blueprint(member_main,url_prefix='/member')


if __name__ == "__main__":
    app.run(debug=True, host='0.0.0.0', port=5000)